package gam.n1.achievement.n;

import gam.n1.achievement.iAchievement;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.function.Supplier;

public class IntegerAchievement extends BaseAchievement<Integer> {
    public IntegerAchievement(@NotNull Supplier<Integer> initValue, @Nullable String name) {
        super(initValue, name);
    }

    @Override
    public void set(Integer integer) {
        $t = integer >= Integer.MAX_VALUE || integer <= Integer.MIN_VALUE ? 0 : integer;
    }

    @Override
    public Class<Integer> t() {
        return Integer.class;
    }

    @Override
    public iAchievement<Integer> copy() {
        return new IntegerAchievement(valueF,name);
    }
}
